package com.smart.member.controller;

import com.qf.common.result.ResponseResult;
import com.smart.coupon.template.dto.CouponDTO;
import com.smart.member.service.MemberService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 查询会员的优惠券信息
 * query
 * search
 * get
 */
@RestController
@RequestMapping("/member")
public class MemberController {
    @Resource
    MemberService memberService;

    @GetMapping("/coupons")
    public ResponseResult<List<CouponDTO>> getCouponList(@RequestParam Long memberId) {
        return memberService.getCouponList(memberId);
    }

    @GetMapping("/code")
    public ResponseResult<Integer> getVerificationCode(@RequestParam String phone) {
        return ResponseResult.success(memberService.getVerificationCode(phone));
    }
}
